﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="PasswordGeneratorImpl.cs" company="Marcin Jastrzebski">
//   Copyright (c) Marcin Jastrzebski (marcin@marcinj.net)
// </copyright>
// <summary>
//   The password generator implementation.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace mPassRT.Services
{
    using System.Threading.Tasks;

    using PopupLibrary;

    using mPassRT.Controls;

    /// <summary>The password generator implementation.</summary>
    public class PasswordGeneratorImpl : IPasswordGenerator
    {
        #region Public Methods and Operators

        /// <summary>Generates a password.</summary>
        /// <returns>A task that will produce a password or null if 
        /// password generation was cancelled</returns>
        public async Task<string> GeneratePasswordAsync()
        {
            object result = await PopupManager.ShowAsync(new PasswordGeneratorControl());
            return result as string;
        }

        #endregion
    }
}